<?php

namespace app\common\access;

use app\common\model\book\Book as BookModel;

class Book
{
    public function __construct(
        BookModel $bookModel
    ) {
        $this->bookModel = $bookModel;
    }

    public function check($id)
    {
        $book = $this->bookModel
            ->where(['id' => $id, 'user_id' => request()->user->id])
            ->find();
        if (empty($book)) {
            exception('恶意获取数据', 10000, '\app\common\exception\AccessHandler');
        }
    }
}
